package com.mc.developmentkit.activitys;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.qamaster.android.R;
import com.mc.developmentkit.views.TitleManger;


/**
 * Created by John_王明阁 on 2016/5/13.
 */
public class AgreementActivity extends Activity{

    private WebView webView_XieYi;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_agreement);
        TitleManger insetance = TitleManger.getInsetance();
        insetance.setContext(this);
        insetance.setName(getIntent().getStringExtra("title"));
        initView();
        initData();
    }

    private void initView() {
        webView_XieYi = (WebView) findViewById(R.id.xieyi_web);
    }

    private void initData() {
        Log.e("WebView将要加载的网页",getIntent().getStringExtra("url"));
        webView_XieYi.loadUrl(getIntent().getStringExtra("url"));
        //覆盖WebView默认使用第三方或系统默认浏览器打开网页的行为，使网页用WebView打开
        webView_XieYi.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
                view.loadUrl(url);
                return true;
            }
        });
    }

}
